package com.webserver.core;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

/**
 * 处理与指定客户端的一次HTTP交互
 */
public class ClientHandler implements Runnable{
    private Socket socket;
    public ClientHandler(Socket socket){
        this.socket = socket;
    }
    public void run() {
        try {
            InputStream in = socket.getInputStream();
            int d;

            while((d = in.read())!=-1){
                System.out.print((char)d);
            }
            /*
                上述内容写好后，打开浏览器输入网址:http://localhost:8088/index.html
                测试读取浏览器发送过来的请求内容并在控制台上确认内容
             */



        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}






